//#define VERBOSE
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

int m,n;
int vals[20];
int recVals[20];
int recIdx;
int idx=0;
int globalMax = -1;
const int MAXVAL = 2000;
//bool hadValB[MAXVAL];
int hadValI[MAXVAL];
int hadValIdx = 1;
int newVal[MAXVAL];
int newValIdx = 0;
int tmpVal[MAXVAL];

int maxVal;

int calMax(int allowNum) {
	hadValIdx = 1;
	hadValI[0] = 0;
	newValIdx = 0;
	for (int i=0; i<allowNum; ++i) {
#ifdef VERBOSE
		for (int j=0; j<hadValIdx; ++j)
			cout << hadValI[j] << " ";
		cout << ": hadValI" << endl;
#endif
		memcpy(tmpVal, hadValI, hadValIdx*sizeof(int));
		for (int j=0; j<hadValIdx; ++j)
			for (int k=0; k<idx; ++k, ++newValIdx)
				newVal[newValIdx] = hadValI[j] + vals[k];
		sort(newVal, newVal+newValIdx);
		newValIdx = unique(newVal, newVal+newValIdx) - newVal;
#ifdef VERBOSE
		for (int j=0; j<newValIdx; ++j)
			cout << newVal[j] << " ";
		cout << ": newVal" << endl;
#endif
		int a=0, b=0;
		int newIdx = 0;
		for (int i=0; i<hadValIdx+newValIdx; ++i) {
			if (a==hadValIdx)
				hadValI[newIdx++] = newVal[b++];
			else if (b==newValIdx)
				hadValI[newIdx++] = tmpVal[a++];
			else if (tmpVal[a] < newVal[b])
				hadValI[newIdx++] = tmpVal[a++];
			else if (tmpVal[a] > newVal[b])
				hadValI[newIdx++] = newVal[b++];
			else {
				hadValI[newIdx++] = newVal[b];
				++a;
				++b;
				++i;
			}
		}
		hadValIdx = newIdx;
#ifdef VERBOSE
		for (int j=0; j<hadValIdx; ++j)
			cout << hadValI[j] << " ";
		cout << ": merged hadValI" << endl;
#endif
	}
	for (int i=0; i<hadValIdx; ++i)
		if (hadValI[i] != i)
			return i-1;
	return hadValIdx-1;
}

void search(int allowNum, int allowType, int curMax, int allowMin) {
	if (allowType == 0) {
		if (globalMax < curMax) {
			globalMax = curMax;
			recIdx = idx;
			for (int i=0; i<idx; ++i)
				recVals[i] = vals[i];
		}
		return;
	}
	for (int i=allowMin;i<=curMax+1;++i) {
		vals[idx++] = i;
// 		for (int j=0; j<idx; ++j)
// 			cout << vals[j] << " ";
// 		cout << ": vals." << endl;
// 		cout << "MAX: " << calMax(allowNum) << endl;
		search(allowNum, allowType-1, calMax(allowNum), i+1);
		--idx;
	}
}

int main(void)
{
	while (true) {
		cin >> m >> n;
		if (m==0 && n==0) break;
		globalMax = -1;
		search(m, n, 0, 1);
		for (int i=0; i<recIdx; ++i)
			cout << setw(3) << recVals[i];
		cout << " ->" << setw(3) << globalMax << endl;
	}
	return 0;
}